package com.bolt.support.freemarker;

import freemarker.cache.TemplateLoader;

import java.io.Reader;
import java.io.StringReader;

/**
 * Created by Administrator on 2020/10/13.
 */
public class StringTemplateLoader implements TemplateLoader {

    @Override
    public Object findTemplateSource(String name) {
        return name;
    }

    @Override
    public long getLastModified(Object templateSource) {
        return System.currentTimeMillis();
    }

    @Override
    public Reader getReader(Object templateSource, String encoding) {
        return new StringReader((String) templateSource);
    }

    @Override
    public void closeTemplateSource(Object templateSource) {
        // ignore
    }

}

 